
import java.io.*;
import java.net.*;
import java.util.*;

import javax.swing.Icon;
import javax.swing.ImageIcon;


public class ExciteSearchWorker extends SearchWorker
{
    private final static String template = 
	"<A HREF=\"http://search.excite.com/relocate/@(any);http://@(any=url)\">"
	+ " @(any=title)</A>&nbsp;"
	+ " @(any=text)<BR>";

    private final static PageParser parser = new PageParser(template);

    private final static Icon icon = new ImageIcon("images/excite.gif");


    public ExciteSearchWorker(Search search, String query) {
	super(search, query);
    }

    protected PageParser getPageParser() {
	return parser;
    }

    /**
     * This URL approximates an Excite query for keyword q, page t.
     */
    protected URL getPageURL(String q, int t) throws MalformedURLException {
	String queryURLString = 
	    "http://search.excite.com/search.gw?c=web&s=" + q + "&showSummary=true&start=" + t;
	return new URL(queryURLString);
    }

    public String getSiteName() {
	return "Excite";
    }

    public Icon getSiteIcon() {
	return icon;
    }
}

